package cn.stylefeng.guns.modular.yingbao.controller;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.modular.yingbao.entity.SysGroupSetting;
import cn.stylefeng.guns.modular.yingbao.model.params.SysGroupSettingParam;
import cn.stylefeng.guns.modular.yingbao.service.SysGroupSettingService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 团队收益设置表控制器
 *
 * @author jj
 * @Date 2019-12-18 13:51:40
 */
@CrossOrigin
@Controller
@RequestMapping("/sysGroupSetting")
public class SysGroupSettingController extends BaseController {

    private String PREFIX = "/sysGroupSetting";

    @Autowired
    private SysGroupSettingService sysGroupSettingService;

    /**
     * 跳转到主页面
     *
     * @author jj
     * @Date 2019-12-18
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "/sysGroupSetting.html";
    }

    /**
     * 新增页面
     *
     * @author jj
     * @Date 2019-12-18
     */
    @RequestMapping("/add")
    public String add() {
        return PREFIX + "/sysGroupSetting_add.html";
    }

    /**
     * 编辑页面
     *
     * @author jj
     * @Date 2019-12-18
     */
    @RequestMapping("/edit")
    public String edit() {
        return PREFIX + "/sysGroupSetting_edit.html";
    }

    /**
     * 新增接口
     *
     * @author jj
     * @Date 2019-12-18
     */
    @RequestMapping("/addItem")
    @ResponseBody
    public ResponseData addItem(SysGroupSettingParam sysGroupSettingParam) {
        return this.sysGroupSettingService.add(sysGroupSettingParam);
    }

    /**
     * 编辑接口
     *
     * @author jj
     * @Date 2019-12-18
     */
    @RequestMapping("/editItem")
    @ResponseBody
    public ResponseData editItem(SysGroupSettingParam sysGroupSettingParam) {
        this.sysGroupSettingService.update(sysGroupSettingParam);
        return ResponseData.success();
    }

    /**
     * 删除接口
     *
     * @author jj
     * @Date 2019-12-18
     */
    @RequestMapping("/delete")
    @ResponseBody
    public ResponseData delete(SysGroupSettingParam sysGroupSettingParam) {
        this.sysGroupSettingService.delete(sysGroupSettingParam);
        return ResponseData.success();
    }

    /**
     * 查看详情接口
     *
     * @author jj
     * @Date 2019-12-18
     */
    @RequestMapping("/detail")
    @ResponseBody
    public ResponseData detail(SysGroupSettingParam sysGroupSettingParam) {
        SysGroupSetting detail = this.sysGroupSettingService.getById(sysGroupSettingParam.getId());
        return ResponseData.success(detail);
    }

    /**
     * 查询列表
     *
     * @author jj
     * @Date 2019-12-18
     */
    @ResponseBody
    @RequestMapping("/list")
    public LayuiPageInfo list(SysGroupSettingParam sysGroupSettingParam) {
        return this.sysGroupSettingService.findPageBySpec(sysGroupSettingParam);
    }

}


